<template>
  <el-select
    v-model="inputValue"
    v-bind="{
    ...$attrs,
    placeholder: $attrs.placeholder || '请选择投诉等级'
  }" v-on="$listeners">
    <el-option v-for="item in options" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey">
      <span :class="{'c-red': item.dictValue == '更换款式'}">{{ item.dictValue }} {{item.dictValue == '更换款式' ? '（生产专选）' : '' }}</span>
    </el-option>
  </el-select>
</template>

<script>
import inputValueMixin from '@/mixins/inputValueMixin'
import {
  getCacheData, 
} from "@/const/cacheData"
export default {
  name: 'ComplaintLevelSelect',
  mixins: [inputValueMixin],
  props: {
  },
  data() {
    return {
      options: [],
    };
  },
  methods: {
    getOptions() {
      //投诉等级列表
      getCacheData("complaintLevelList").then(res => {
        this.options = res
      })
    },
    getSelectedItem() {
      const selectedItem = this.options.find(
        (item) => item['dictKey'] === this.inputValue
      );
      return selectedItem || {};
    },
    getSelectedLabel() {
      const selectedItem = this.getSelectedItem();
      return selectedItem['dictValue'];
    },
  },
  created() {
    this.getOptions()
  }
};
</script>

<style scoped lang="scss">

</style>
